﻿using System;
using System.Collections.Generic;
using System.Data.Common;
using MuzoBlog.Core.Helpers;
using MuzoBlog.Core.BussinessLogic.Blog.Entities;

namespace MuzoBlog.Core.BussinessLogic.Settings
{
    public abstract class SettingManager
    {
        public static string GetStringValue(string name)
        {
            Setting setting = MuzoApp.Db.Settings.Find(s => s.Name == name);
            if (setting == null)
                return string.Empty;

            return Convert.ToString(setting.Value);
        }

        public static int GetIntegerValue(string name)
        {
            string value = GetStringValue(name);
            return Convert.ToInt32(value);
        }

        public static bool GetBooleanValue(string name)
        {
            string value = GetStringValue(name);
            return Convert.ToBoolean(value);
        }

        public static decimal GetDecimalValue(string name)
        {
            string value = GetStringValue(name);
            return Convert.ToDecimal(value);
        }
    }
}
